package gui.layer;

import java.io.IOException;

/**
 * Class for the power ups layer.
 * @author Sandra Mayer
 *
 */
public class PowerUpsTiledLayer extends BaseLayer {
	
	public final static String FILENAME = "";
	
	/**
	 * Constructor
	 * @throws IOException IOException
	 */
	public PowerUpsTiledLayer() throws IOException {
		super(BaseLayer.NROFCELLSHOR,
				BaseLayer.NROFCELLSVER, FILENAME,
				BaseLayer.SIZEOFCELL, BaseLayer.SIZEOFCELL);
	}
	
	/**
	 * Updates the game field with the new positions of the power ups.
	 * @param posOfPowerUps the position of the power ups
	 */
	public void update(int[] posOfPowerUps) {
	  
	  // set the background with the images
	  for (int i = 0; i < posOfPowerUps.length; i++) {
	    int column = i % NROFCELLSHOR;
	    int row = (i - column)/NROFCELLSHOR;
	    this.setCell(column, row, posOfPowerUps[i]);
	  }
	  
	  // set the location of the background
	  this.setPosition(GAME_ORIGIN_X, GAME_ORIGIN_Y); 
	}
}
